
<?php
$filename = "C:\\AppServ\\www\\szofttech_src\\workdir\\ARTIKELC1.txt";
$TableName = "Product";

// Get a file into an array.  In this example we'll go through HTTP to get
// the HTML source of a URL.
$lines = file($filename);

$query = "";
$i=0;
// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {
	if ($i != 0)
	{
		$fields = explode(',', $line);
		$query .= "INSERT INTO ".$TableName." VALUES (";
		$f = 0;
		foreach($fields as $field)
		{
			if($f != 0) $query .= ", ";
			if ($field)
			{
				if ( !is_numeric($field) )
				{
					$query .= "'";
					$query .= $field;
					$query .= "'";				
				}
				else
				{
					$query .= $field;
				}
			}
			else
			{
				$query .= "NULL";
			}
			$f++;
			
		}
		$query .= " ,0,0,0,0);\r\n<br>";
		// echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
	}
	$i++;
}
echo $query;

// Another example, let's get a web page into a string.  See also file_get_contents().
// $html = implode('', file('http://www.example.com/'));

// Using the optional flags parameter since PHP 5
// $trimmed = file('somefile.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

?>